#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;


unsigned long long int min_txt_count;
unsigned long long int all_txt_count;
unsigned long long int sim_txt_count;
unsigned long long int result_txt_count;

string data_path = "C:\\Users\\ismtxt\\Desktop\\data\\CIA003GR\\";

// 4_result_size.txt

string integer_to_string(int value)
{
	stringstream ss;
	ss << value << endl;
	string ans;
	ss >> ans;
	return ans;
}

unsigned long long int count_txt_set(int k, string str)
{
	ifstream infile_min_txt(data_path + integer_to_string(k) + str, ios::in);
	unsigned long long int count = 0;
	unsigned long long tmp;
	while (infile_min_txt >> tmp)
	{
		count++;
	}
	return count;
}



int main()
{
	int k;
	cout << "Input K:";
	cin >> k;

	
	// ---- min_txt_count = count_min_txt_set(k);
	min_txt_count = count_txt_set(k, "_min.txt");
	all_txt_count = count_txt_set(k, "_all.txt");
	sim_txt_count = count_txt_set(k, "_sim.txt");
	result_txt_count = count_txt_set(k, "_result.txt");

	unsigned long long int shit = -1;
	if (all_txt_count % min_txt_count == 0)
	{
		shit = all_txt_count / min_txt_count;
		cout << min_txt_count << "*" << shit << " ";
	}
	else
	{
		cout << "NULL" << " ";
	}

	unsigned long long int fuck = -1;
	if (sim_txt_count % shit == 0)
	{
		fuck = sim_txt_count / shit;
		cout << fuck << "*" << shit << " ";
	}
	else
	{
		cout << "NULL" << " ";
	}


	cout << min_txt_count << " ";

	if (fuck * min_txt_count == result_txt_count)
	{
		cout << fuck << "*" << min_txt_count << endl;
		ofstream outfile_result_size(data_path + integer_to_string(k) + "_result_size.txt", ios::out);
		outfile_result_size << fuck << " " << min_txt_count << endl;
		outfile_result_size.close();
	}

	
	
	system("pause");
	return 0;
}


